package cn.lijiajia3515.cairo.auth.framework.security.web.authentication;


import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Optional;

@Slf4j
public class CairoLogLogoutHandler implements LogoutHandler {
	@Override
	public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
		Optional.ofNullable(authentication)
			.map(Authentication::getName)
			.ifPresent(a -> log.debug("authentication logout: {}", a));
	}
}
